﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;

namespace MyProgram.library
{
    public class ComputerInformation 
    {
        public void test()
        {
            string cpuSerial = GetCpuId();

        }
        public static string GetCpuId()
        {
            string cpuSerialNumber = "";
            try
            {
                //ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT ProcessorId FROM Win32_Processor");
                //foreach (ManagementObject obj in searcher.Get())
                //{
                //    cpuSerialNumber = obj["ProcessorId"].ToString();
                //    break; // Assuming there is only one CPU in the system
                //}
            }
            catch (Exception ex)
            {
                // Handle exception
                Console.WriteLine("An error occurred while retrieving CPU serial number: " + ex.Message);
            }
            return cpuSerialNumber;
        }
    }
}
